Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

algoliasearch-helper

Package Overview
Dependencies
Maintainers
0
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algoliasearch-helper

Helper for implementing advanced search features with algolia

  • 3.22.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
880K
increased by5.04%
Maintainers
0
Weekly downloads
 
Created

What is algoliasearch-helper?

The `algoliasearch-helper` package is a JavaScript library that provides a set of tools to manage search parameters and results when using Algolia's search API. It helps in building complex search interfaces by offering functionalities like managing search states, refining search queries, and handling pagination.

What are algoliasearch-helper's main functionalities?

Managing Search Parameters

This feature allows you to manage search parameters such as facets and disjunctive facets. The code sample demonstrates how to initialize the helper with specific facets and add a facet refinement to filter search results.

const algoliasearch = require('algoliasearch');
const algoliasearchHelper = require('algoliasearch-helper');

const client = algoliasearch('YourApplicationID', 'YourAdminAPIKey');
const index = client.initIndex('your_index_name');
const helper = algoliasearchHelper(client, 'your_index_name', {
  facets: ['category'],
  disjunctiveFacets: ['brand']
});

helper.addFacetRefinement('category', 'Books').search();

Handling Pagination

This feature helps in handling pagination of search results. The code sample shows how to set the page number and listen for the search results.

helper.setPage(2).search();

helper.on('result', function(content) {
  console.log(content.hits);
});

Refining Search Queries

This feature allows you to refine search queries. The code sample demonstrates how to set a search query and listen for the search results.

helper.setQuery('Harry Potter').search();

helper.on('result', function(content) {
  console.log(content.hits);
});

Managing Search States

This feature allows you to manage the search state. The code sample shows how to get the current search state and set a new search state.

const state = helper.getState();
console.log(state);

helper.setState({
  query: 'Harry Potter',
  page: 1
}).search();

Other packages similar to algoliasearch-helper

FAQs

Package last updated on 09 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc